<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
  <div region="center" style="padding:0px;border:0px">
  <t:datagrid name="deviceApplyList"  fitColumns="true" title="设备预约申请" actionUrl="deviceAppointApplyController.do?auditDatagrid" idField="id" fit="true" >
  <t:dgCol title="主键"  field="id"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
  <t:dgCol title="状态值"  field="applyStateValue"  hidden="true"  queryMode="single" width="80" ></t:dgCol>  
   <t:dgCol title="申请人"  field="applyUser.realName"   queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="品牌"  field="device.brand.brandName"   queryMode="single"  width="120"></t:dgCol> 
   <t:dgCol title="型号"  field="device.model.modelName"    queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="设备编号"  field="device.deviceNo"    queryMode="single"  width="120"></t:dgCol> 
   <t:dgCol title="预约日期"  field="applyStartDate" formatter="yyyy-MM-dd"   queryMode="single"  width="100"></t:dgCol> 
   <t:dgCol title="预约归还日期"  field="applyEndDate" formatter="yyyy-MM-dd"   queryMode="single"  width="100"></t:dgCol>  
    <t:dgCol title="领用说明"  field="remark"    queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="操作" field="opt" width="130"></t:dgCol>
   <t:dgFunOpt funname="passApply(id)" title="通过"></t:dgFunOpt> 
   <t:dgFunOpt funname="fialPassApply(id)" title="不通过"></t:dgFunOpt> 
    <t:dgToolBar title="查看" icon="icon-search" url="deviceAppointApplyController.do?goUpdate" funname="detail"></t:dgToolBar> 
  </t:datagrid>
  </div>
 </div>
 <script type="text/javascript"> 
	function passApply(id){
		$.dialog.confirm('确定要审核通过吗?', function(r) {
			   if (r) { 
					$.ajax({
						url : 'deviceAppointApplyController.do?doAudit&result=1&id='+id,
						type : 'post', 
						cache : false,
						success : function(data) {
							var d = $.parseJSON(data);
							if (d.success) {
								var msg = d.msg;
								tip(msg);
								reloadTable(); 
							}else{
								tip(msg);
							}
						}
					});
				}
			}); 
	}
	
	function fialPassApply(id){
		$.dialog.confirm('确定要审核不通过吗?', function(r) {
			   if (r) { 
					$.ajax({
						url : 'deviceAppointApplyController.do?doAudit&result=0&id='+id,
						type : 'post', 
						cache : false,
						success : function(data) {
							var d = $.parseJSON(data);
							if (d.success) {
								var msg = d.msg;
								tip(msg);
								reloadTable(); 
							}else{
								tip(msg);
							}
						}
					});
				}
			}); 
	}
 </script>